<html>
	<title>计数器</title>
	<body>
		<div id="app">
			<div>
				<button @click='del'> - </button>
				<span>{{ num}}</span>
				<button @click='add'> + </button>
			</div>
		</div>
		<script  src='./js/vue.js'></script>
		<script>
			var app = new Vue({
				el:'#app',
				data:{
					num:0,
				},
				methods:{
					add:function(){
						if(this.num<10){
							this.num ++;
						}else{
							alert('太大了')
						}
					},
					del:function(){
						if(this.num>0){
							this.num --;
						}else{
							alert('不能再小了')
						}
					}
				}
			}) 
		</script>
	
	</body>
</html>